{% extends "messages/base.html" %}
{% from "messages/includes/macros.html" import message_form, inbox_message with context %}
{% set title = _('Read Message') %}
{% set crumbs = [(url('messages.inbox'), _('Messages')),
                 (None, title)] %}

{% block content %}
  <div class="grid_9">
    <article class="main">
      <section id="read-message" class="message-view"
        data-message-content="{{ message.message }}">
        <h1>{{ title }}</h1>
        {{ inbox_message(message) }}
        {% if message.sender %}
          <form class="reply" action="{{ url('messages.new') }}" method="POST">
            {% csrf_token %}
            {{ message_form(form) }}
            <div class="submit">
              <button type="submit" class="btn btn-important">{{ _('Reply') }}</button>
              <input type="submit" id="preview-btn" name="preview" value="{{ _('Preview') }}"
                  data-preview-url="{{ url('messages.preview_async') }}"
                  data-preview-container-id="preview"
                  data-preview-content-id="id_message" />
            </div>
          </form>
        {% endif %}
      </section>
      <section id="preview" class="message-view"></section>
    </article>
  </div>
{% endblock %}
